package org.example.mapper;

import org.apache.ibatis.annotations.*;
import org.example.pojo.Couplealbum;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
* @author LENOVO
* @description 针对表【CoupleAlbum(情侣相册表)】的数据库操作Mapper
* @createDate 2024-04-07 16:34:04
* @Entity org.example.pojo.Couplealbum
*/
@Mapper
public interface CouplealbumMapper {

    int deleteByPrimaryKey(Long id);

    int insert(Couplealbum record);

    int insertSelective(Couplealbum record);

    Couplealbum selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Couplealbum record);

    int updateByPrimaryKey(Couplealbum record);

    @Insert("insert into CoupleAlbum(couple_id, cover_image_url, album_name, create_time) " +
            "values (#{userId},#{url},#{albumName},now())")
    void addCoupleAlbum(Integer userId, String albumName, String url);

    @Select("select * from CoupleAlbum where couple_id=#{userId}")
    List<Couplealbum> list(Integer userId);

    @Update("update CoupleAlbum set album_name=#{albumName},cover_image_url=#{url} where id=#{id}")
    void editcoupleAlbum(String id, String albumName, String url);

    @Delete("delete from CoupleAlbum where id=#{id}")
    void deleteCoupleAlbum(String id);
}
